OTSndUData
Sends data using a connectionless transactionless endpoint.C INTERFACE
OSStatus OTSndUData (EndpointRef ref, TUnitData* udata);C++ INTERFACE
OSStatus TEndpoint::SndUData(TUnitData* udata);PARAMETERS
ref
- The endpoint reference of the endpoint sending the data.
udata
- A pointer to a
TUnitData
structure (page 3-55) that specifies the data to be sent and its destination.DESCRIPTION
If the endpoint is in synchronous, blocking mode, theOTSndUData
function returns immediately. If flow-control restrictions prevent its sending the data, it retries the operation until it is able to send it. If the endpoint is in nonblocking mode, theOTSndUData
function returns akOTFlowErr
result if flow-control restrictions prevent the data from being sent. When the endpoint provider is able to send the data, it calls your notifier function, passingT_GODATA
for thecode
parameter. You can then call theOTSndUData
function from your notifier to send the data. You can also retrieve this event by polling the endpoint using theOTLook
function.Some endpoint providers are not able to detect immediately whether you specified incorrect address or option information. In such cases, the provider calls your notifier function when it detects the error, passing the
T_UDERR
for thecode
parameter to advise you that an error has occurred. You can determine the cause of this event by calling theOTRcvUDErr
function and examining the value of theuderr->error
parameter. It is important that you call theOTRcvUDErr
function even if you are not interested in examining the cause of the error. Failing to do this leaves the endpoint in an invalid state for doing other sends and makes the endpoint provider unable to deallocate memory reserved for internal buffers associated with the send.The next table shows how the endpoint's mode of execution and blocking status affects the behavior of the
OTSndUData
function.
Blocking Nonblocking Synchronous The function returns when the provider lifts flow-
control restrictions.The function returns immediately. The kOTFlowErr
result is never returned.The kOTFlowErr
result might be returned.Asynchronous The function returns immediately The function returns immediately The kOTFlowErr
result is never returned.The kOTFlowErr
result might be returned.SPECIAL CONSIDERATIONS
TheXTI_SLOWAT
option allows endpoints that support it to negotiate the minimum number of bytes that must have accumulated in the endpoint's internal send buffer before they are sent. If the endpoint you are using supports this option, you can negotiate a value using theOTOptionManagement
function. Because you use theOTOptionManagement
function to set this option, it affects all subsequent sends.VALID STATES
T_IDLE
SEE ALSO
To read the data, the endpoint to which the data is sent uses theOTRcvUData
function, (page 3-105).You use the
TUnitData
structure (page 3-55) to specify the data to be sent and its destination.You use the
OTData
structure (page 3-52) to transfer noncontiguous data.You use the
OTOptionManagement
function, described in the reference section of the chapter "Option Management" in this book to negotiate a value for theXTI_SNDLOWAT
option.You use the
OTRcvUDErr
function (described next) to retrieve information about the cause of aT_UDERR
event.For information on how to use this function with a TCP/IP protocol, see page 8-18 in the TCP/IP chapter.
For information on how to use this function with the AppleTalk DDP protocol, see page 12-11 in the DDP chapter.
You use the
OTLook
function (page 3-85) to retrieve pending asynchronous events for an endpoint.